<?php 
	require_once('header_sidebar.php');
	require_once('Class/connexionDB.Class.php');
	require_once('Class/displayInHtml.Class.php');
	require_once('Class/session.Class.php');
	
	$session 		= session::getInstance();
	$db 			= new connexionDB();
	$consultant 	= $db->getAllConsultant();
?>
<!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        <?php echo $translate->translate('HomePageAdministration'); ?>
                        <small><?php echo $translate->translate('AdminDescriptionTitle'); ?></small>
                    </h1>
                    <ol class="breadcrumb">
                        <li class="active">
                        	<a href="#">
                        		<i class="fa fa-dashboard"></i><?php echo $translate->translate('HomePageAdministration'); ?>
                        	</a>
                    	</li>
                    </ol>
                </section>
                <!-- Main content -->
                <section class="content">
                	<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog text">
							<div class="modal-content">
							 <div class="modal-header">
							    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
							    <h4 class="modal-title"><?php echo $translate->translate('AdminDeleteAccountPopup'); ?></h4>
							  </div>
							  <div class="modal-body">
							    <div class="alert alert-danger alert-dismissable">
							        <i class="fa fa-ban"></i>
							        <b><?php echo $translate->translate('AdminDeleteAccountPopupAlert'); ?></b><?php echo $translate->translate('AdminDeleteAccountPopupDescription'); ?>
							    </div>
							  </div>
							  <div class="modal-footer">
							  	<form role="form" action="delete_account.php" method="post">
							      	<input type="hidden" name="email_to_delete" value="<?php if (isset($_GET['email'])) { echo $_GET['email']; } ?>">
							        <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $translate->translate('AdminDeleteAccountPopupAlertCancel'); ?></button>
							        <button type="submit" class="btn btn-danger"><?php echo $translate->translate('AdminDeleteAccountPopupAlertValidate'); ?></button>
							    </form>
							  </div>
							</div>
						</div>
					</div>
					<?php if (isset($_GET['account_deleted'])) :?>
						<div class="box box-solid box-success">
	                        <div class="box-header">
	                            <h3 class="box-title"><?php echo $translate->translate('AdminDeleteAccountPopupAlertValidateTitle'); ?></h3>
	                            <div class="box-tools pull-right">
	                                <button class="btn btn-success btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button>
	                                <button class="btn btn-success btn-sm" data-widget="remove"><i class="fa fa-times"></i></button>
	                            </div>
	                        </div>
	                        <div class="box-body" style="display: block;">
	                            <p>
	                                <?php
	                                	echo $_GET['account_deleted'];
	                                ?>
	                            </p>
	                        </div><!-- /.box-body -->
	                    </div>
					<?php endif ?>
                	<?php if (isset($session->name_accountType) && $session->name_accountType == 'admin') :?>
	                	<div class="col-md-6">
	                		<?php if (isset($_GET['accountcreated'])) :?>
			                	<div class="box box-solid box-success">
			                        <div class="box-header">
			                            <h3 class="box-title"><?php echo $translate->translate('AdminAccountCreated'); ?></h3>
			                            <div class="box-tools pull-right">
			                                <button class="btn btn-success btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button>
			                                <button class="btn btn-success btn-sm" data-widget="remove"><i class="fa fa-times"></i></button>
			                            </div>
			                        </div>
			                        <div class="box-body" style="display: block;">
			                            <p>
			                                <?php 
			                                	echo $translate->translate('AdminAccountCreatedDescription'); 
			                                	echo $_GET['accountcreated'];
			                                ?>
			                            </p>
			                        </div><!-- /.box-body -->
			                    </div>
			                <?php endif ?>
		                	<?php if (isset($_GET['error']) && $_GET['error'] == 'notallowedtocreateaccount') :?>
			                	<!-- Danger box -->
			                    <div class="box box-solid box-danger">
			                        <div class="box-header">
			                            <h3 class="box-title"><?php echo $translate->translate('AdminNewAccountAccountErrorCreate'); ?></h3>
			                            <div class="box-tools pull-right">
			                                <button class="btn btn-danger btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button>
			                                <button class="btn btn-danger btn-sm" data-widget="remove"><i class="fa fa-times"></i></button>
			                            </div>
			                        </div>
			                        <div class="box-body">
			                            <p>
			                                <?php echo $translate->translate('AdminNewAccountAccountErrorCreateDescription'); ?>
			                            </p>
			                        </div><!-- /.box-body -->
			                    </div><!-- /.box -->
		                    <?php endif; ?>
		                	<!-- left column -->
	                        <div class="box box-info">
	                            <div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AdminNewAccountTitle'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <form role="form" action="add_account.php" method="post">
	                            	<?php 
	                            		if (isset($_GET['erroremail']) || isset($_GET['errorpassword']))
	                            		{
	                            			$emailHasError = "has-error";
	                            		}
	                            		else
										{
	                            			$emailHasError = "";
	                            		}

	                            	?>
		                            <div class="box-body">
		                                <div class="input-group form-group <?php echo $emailHasError; ?>">
		                                    <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
		                                    <?php if (isset($_GET['erroremail'])) :?>
		                                    	<div class="control-label" for="inputError"><i class="fa fa-times-circle-o"> <?php echo $translate->translate('AdminNewAccountErrorEmail'); ?></i></div>
		                                	<?php endif ?>
		                                    <input id="emailNewAccount" name="emailNewAccount" type="text" class="form-group form-control" placeholder="<?php echo $translate->translate('SignInPageEmail'); ?>" autocomplete="off">
		                                    <?php if (isset($_GET['errorpassword'])) :?>
		                                    	<div class="control-label" for="inputError"><i class="fa fa-times-circle-o"> <?php echo $translate->translate('AdminNewAccountErrorPassword'); ?></i></div>
		                                    <?php endif ?>
		                                    <input id="passwordNewAccount" name="passwordNewAccount" type="password" class="form-group form-control" placeholder="<?php echo $translate->translate('SignInPagePassword'); ?>" autocomplete="off">
		                                    <input id="passwordRepeat" name="passwordRepeat" type="password" class="form-group form-control" placeholder="<?php echo $translate->translate('AdminNewAccountRepeatPassword'); ?>">
		                                </div>
		                                <br/>
		                                <div class="form-group" style="margin:20px;">
											<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountFirstname'); ?></label>
											<div class="col-sm-10">
												<input name="firstnameNewAccount" type="text" class="form-control" placeholder="">
											</div>
										</div>
										<br/>
										<div class="form-group" style="margin:20px;">
											<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountLastname'); ?></label>
											<div class="col-sm-10">
												<input name="lastnameNewAccount" type="text" class="form-control" placeholder="">
											</div>
										</div>
										<br/>
										<div class="form-group" style="margin:20px;">
											<label class="col-sm-4 control-label"><?php echo $translate->translate('team'); ?> <small><i><?php echo $translate->translate('descriptionTeam'); ?></i></small></label>
											<div class="col-sm-8">
												<input name="team" type="text" class="form-control" placeholder="">
											</div>
										</div>
										<br>
										<br/>
		                                <div class="form-group" style="margin:20px;">
		                                	<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountType'); ?></label>
		                                	<div class="col-sm-10" style="margin:20px;">
				                                <input type='radio' name='accountType' value='1'>Admin<br>
				                                <input type='radio' name='accountType' value='2'>Manager<br>
											</div>
										</div>
										<br/>
										<div class="form-group">
		                                	<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountGroup'); ?></label>
		                                	<div class="col-sm-10" style="margin:20px;">
		                                		<?php $groups = $db->getListedGroup(); ?>
		                                		<?php foreach ($groups as $key => $value) : ?>
			                                		<div class='col-sm-4'>
														<label>
															<input name="<?php echo 'group' . $value['id'] ; ?>" type='checkbox' value='<?php echo $value['id']; ?>'>
														</label>
														<label>
															<?php echo $value['name']; ?>
														</label>
													</div>
												<?php endforeach ?>
											</div>
										</div>
										<br/>
										<div class="box-footer" style="margin-top:300px;">
		                                    <button id="validateNewForm" type="submit" class="btn btn-primary"><?php echo $translate->translate('validate'); ?></button>
		                                </div>
	                               	</div><!-- /.box-body -->
	                            </form>
	                        </div><!-- /.box -->
	                	</div><!--/.col (left) -->
	                	<div class="col-md-6">
	                		<?php if (isset($_GET['accountstatus'])) :?>
			                	<div class="box box-solid box-success">
			                        <div class="box-header">
			                            <h3 class="box-title"><?php echo $translate->translate('AdminUpdateTitle'); ?></h3>
			                            <div class="box-tools pull-right">
			                                <button class="btn btn-success btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button>
			                                <button class="btn btn-success btn-sm" data-widget="remove"><i class="fa fa-times"></i></button>
			                            </div>
			                        </div>
			                        <div class="box-body text-green" style="display: block;">
			                            <p>
			                                <?php 
			                                	echo $translate->translate('AdminUpdateDescription');
			                                	echo $_GET['email'];
			                                ?>
			                            </p>
			                        </div>
			                    </div>
			                <?php endif ?>
	                		<div class="box box-success">
	                            <div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AdminModifyAccount'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <div class="box-body">
	                            	<form role="form" action="edit_account.php" method="post">
	                            		<div class="box-body">
		                                	<div class="input-group form-group">
			                                    <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
			                                    <input name="emailEditAccountSearch" class="form-group form-control" placeholder="<?php echo $translate->translate('AdminModifyAccountEmail'); ?>" required>
			                                </div>
			                                <div class="box-footer" >
			                                	<button class="btn btn-success"><?php echo $translate->translate('AdminModifySearchEmail'); ?></button>
			                            	</div>
			                        	</div>
	                            	</form>
	                            	<!-- Form edit -->
	                            	<?php if (isset($_GET['id_groups'])) :?>
		                            	<div class="box-footer text-light-blue">
		                            		<form role="form" action="edit_account.php" method="post">
		                            			<div class="input-group form-group">
				                                    <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
				                                    <input name="emailEditAccount" class="form-group form-control" value="<?php echo $_GET['email']?>" readonly>
				                                    <input name="passwordEditAccount" type="password" class="form-group form-control" placeholder="<?php echo $translate->translate('AdminModifyPassword'); ?>">
				                                    <input name="passwordEditRepeat" type="password" class="form-group form-control" placeholder="<?php echo $translate->translate('AdminModifyPasswordRepeat'); ?>">
				                                </div>
				                                <br/>
				                                <div class="form-group">
													<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountFirstname'); ?></label>
													<div class="col-sm-10">
														<input name="firstnameEditAccount" type="text" class="form-control" value="<?php if (isset($_GET['firstname'])) { echo ucfirst($_GET['firstname']); } ?>">
													</div>
												</div>
												<br/>
												<div class="form-group">
													<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountLastname'); ?></label>
													<div class="col-sm-10">
														<input name="lastnameEditAccount" type="text" class="form-control" value="<?php if (isset($_GET['lastname'])) { echo ucfirst($_GET['lastname']); }?>" >
													</div>
												</div>
												<div class="form-group" >
													<label class="col-sm-4 control-label"><?php echo $translate->translate('team'); ?> <small><i><?php echo $translate->translate('descriptionTeam'); ?></i></small></label>
													<div class="col-sm-8">
														<input name="editTeam" type="text" class="form-control" value="<?php if (isset($_GET['team'])) { echo ucfirst($_GET['team']); }?>">
													</div>
												</div>
												<br/>
												<div class="form-group" >
													<?php 
														$country = $db->getCountry();
													?>
													<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountCountry'); ?></label>
													<div class="col-sm-10">
														<select class="form-control" name="countryEditAccount">
															<?php foreach ($country as $key => $value) : ?>
																<option value="<?php echo $value['id']; ?>" <?php if (isset($_GET['id_country']) && $_GET['id_country'] == $value['id']) { echo 'selected'; }?> ><?php echo $value['name']; ?></option>
															<?php endforeach ?>
														</select>
													</div>
												</div>
												<div class="form-group">
				                                	<label class="col-sm-3 control-label"><?php echo $translate->translate('AdminNewAccountAccountType'); ?></label>
				                                	<div class="col-sm-9">
					                                	<?php
					                                		echo displayInHtml::getRadioListFromArray('accountEditType', $_GET['id_account_type']);
					                                	?>
													</div>
												</div>
												<br/>
												<div class="form-group">
				                                	<label class="col-sm-2 control-label"><?php echo $translate->translate('AdminNewAccountAccountGroup'); ?></label>
				                                	<div class="col-sm-10">
					                                	<?php
															echo displayInHtml::getCheckedListFromArray($groups, $_GET['id_groups']);
														?>
													</div>
												</div>
												<br/>
												<div class="box-footer " style="margin-top:200px;">
			                                    	<button type="submit" class="btn btn-primary"><?php echo $translate->translate('AdminModifySaveEmail'); ?></button>
			                                    	<button type="button" data-toggle="modal" data-target="#myModal" class="btn btn-danger"><?php echo $translate->translate('AdminDeleteAccount'); ?></button>
			                                	</div>
		                            		</form>
		                            	</div>
		                            <?php endif ?><!-- /. Form Edit -->
		                            <?php if (isset($_GET['noresult'])) :?>
		                            	<div class="alert alert-warning alert-dismissable">
	                                        <i class="fa fa-warning"></i>
	                                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
	                                        <b><?php echo $translate->translate('AdminDeleteAccountPopupAlert'); ?></b> 
	                                        <?php 
	                                        	echo $translate->translate('WarningNoAccountFound'); 
	                                        	echo " : " . $_GET['noresult'];
                                        	?>
	                                    </div>
		                        	<?php endif ?>
	                            </div><!-- /.box-body -->
	                        </div>
	                        <div class="box box-primary">
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AddTopic'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <form id="addTopic" role="form" action="admin.php" method="post">
	                            	<?php 
	                            		require_once("Class/evaluation.Class.php");

                                        $eval = new evaluation();
                                        $result = $eval->listedTopic();
                                        $list = displayInHtml::getSelectListFromArray($result);
                                    ?>
	                                <div class="box-body">
	                                    <div class="box-content form-group">
	                                        <label for="topic"><?php echo $translate->translate('NameTopic'); ?></label>
	                                        <input type="text" class="form-control" id="topicAdd" name="topic">
	                                    </div>
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectTheme"><?php echo $translate->translate('ExampleListTopic'); ?></label>
		                                    <select id="selectTheme" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php echo $list;?>
		                                    </select>
		                                </div>
	                                </div>
	                                <input hidden type="text" name="add" value="topic">
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtn" type="submitBtn" class="btn btn-primary"><?php echo $translate->translate('AddTopic'); ?></button>
                                </div>
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('DeleteTopic'); ?></h3>
	                            </div>
	                            <form role="form" action="admin.php" method="post">
	                            	<div class="box-body">
	                            		<label for="list_topic"><?php echo $translate->translate('DescriptionListTopic'); ?></label>
	                            		<div id="list_topic" class="box-content form-group">
	                            			<select id="topicDel" name="topicDel" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	foreach ($result as $key => $value)
		                                        	{
		                                        		echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
	                            		</div>
	                                </div>
	                                <input hidden type="text" name="del" value="topic">
	                                <div class="box-footer">
	                                    <button id="submitBtnDel" type="submit" class="btn btn-danger"><?php echo $translate->translate('DeleteTopic'); ?></button>
	                                </div>
	                            </form>
                            </div>
	                	</div>
	                	<div class="col-md-6">
	                		<div class="box box-primary">
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AddGroup'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <form id="formAddGroup" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group">
	                                        <label for="addGroup"><?php echo $translate->translate('nameNewGroup'); ?></label>
	                                        <input type="text" class="form-control" id="addGroup" name="addGroup">
	                                    </div>
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectGroup"><?php echo $translate->translate('AdminNewAccountAccountGroup'); ?></label>
		                                    <select id="selectGroup" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	foreach ($groups as $key => $value)
		                                        	{
		                                        		echo "<option>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnGroup" type="submitBtn" class="btn btn-primary"><?php echo $translate->translate('AddGroup'); ?></button>
                                </div>
                                <div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('deleteGroup'); ?></h3>
	                            </div>
	                            <form id="formDelGroup" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectGroup"><?php echo $translate->translate('AdminNewAccountAccountGroup'); ?></label>
		                                    <select id="selectGroup" name="selectGroup" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	foreach ($groups as $key => $value)
		                                        	{
		                                        		echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnGroupDel" type="submitBtn" class="btn btn-danger"><?php echo $translate->translate('deleteGroup'); ?></button>
                                </div>
                            </div>
	                	</div>
	                	<div class='col-md-6'>
	                		<div class="box box-primary">
		                		<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('addUnacceptable'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <form id="fromAddUnacceptable" role="form" action="admin.php" method="post">
	                            	<?php
                                        $unacceptable = $db->getUnacceptable();
                                    ?>
	                                <div class="box-body">
	                                    <div class="box-content form-group">
	                                        <label for="topic"><?php echo $translate->translate('descriptionUnacceptable'); ?></label>
	                                        <input type="text" class="form-control" id="addUnacceptable" name="addUnacceptable">
	                                    </div>
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectUnacceptable"><?php echo $translate->translate('ExampleListTopic'); ?></label>
		                                    <select id="selectUnacceptable" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 

		                                        	foreach ($unacceptable as $key => $value)
		                                        	{
		                                        		echo "<option value='".$value['id']."'>". $value['description'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                                <input hidden type="text" name="add" value="topic">
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnUnacceptable" type="submitBtn" class="btn btn-primary"><?php echo $translate->translate('addUnacceptable'); ?></button>
                                </div>
                                <div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('deleteUnacceptable'); ?></h3>
	                            </div>
	                            <form id="formDeleteUnacceptable" role="form" action="admin.php" method="post">
	                            	<div class="box-body">
	                            		<label for="list_topic"><?php echo $translate->translate('listUnacceptable'); ?></label>
	                            		<div id="list_topic" class="box-content form-group">
	                            			<select id="deleteUnacceptable" name="deleteUnacceptable" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	foreach ($unacceptable as $key => $value)
		                                        	{
		                                        		echo "<option value='".$value['id']."'>". $value['description'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
	                            		</div>
	                                </div>
	                                <div class="box-footer">
	                                    <button id="submitBtnDelUnacceptable" type="submit" class="btn btn-danger"><?php echo $translate->translate('deleteUnacceptable'); ?></button>
	                                </div>
	                            </form>
		                	</div>
		                </div>
		                <div class="col-md-6">
	                		<div class="box box-primary">
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AddCC'); ?></h3>
	                                <div class="box-tools pull-right">
	                                    <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
	                                    <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
	                                </div>
	                            </div>
	                            <form id="addConsultant" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group">
	                                        <label for="topic"><?php echo $translate->translate('nameCC'); ?></label>
	                                        <input type="text" class="form-control" id="consultantAdd" name="consultant">
	                                    </div>
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectCC"><?php echo $translate->translate('listCC'); ?></label>
		                                    <select id="selectCC" class="form-control">
		                                    	<option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                    	<?php foreach ($consultant as $value) :?>
		                                        	<option value="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></option>
		                                        <?php endforeach ?>
		                                    </select>
		                                </div>
	                                </div>
	                                <input hidden type="text" name="add" value="topic">
	                            </form>
	                            <div class="box-footer">
	                                <button id="submitBtnCC" type="submitBtn" class="btn btn-primary"><?php echo $translate->translate('AddCC'); ?></button>
	                            </div>
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('delCC'); ?></h3>
	                            </div>
	                            <form role="form" action="admin.php" method="post">
	                            	<div class="box-body">
	                            		<label for="list_topic"><?php echo $translate->translate('nameCC'); ?></label>
	                            		<div id="list_topic" class="box-content form-group">
	                            			<select id="ccDel" name="ccDel" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php foreach ($consultant as $value) :?>
		                                        	<option value="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></option>
		                                        <?php endforeach ?>
		                                    </select>
	                            		</div>
	                                </div>
	                                <input hidden type="text" name="del" value="topic">
	                                <div class="box-footer">
	                                    <button id="submitBtnDel" type="submit" class="btn btn-danger"><?php echo $translate->translate('delCC'); ?></button>
	                                </div>
	                            </form>
	                        </div>
	                	</div>
		                <div class="col-md-6">
	                		<div class="box box-primary">
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AddRecipient'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <form id="formAddRecipient" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group">
	                                        <label for="addRecipient"><?php echo $translate->translate('NameNewRecipient'); ?></label>
	                                        <input type="text" class="form-control" id="addRecipient" name="addRecipient">
	                                    </div>
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectRecipient"><?php echo $translate->translate('Recipient'); ?></label>
		                                    <select id="selectRecipient" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	$recipient = $db->getRecipient();
		                                        	
		                                        	foreach ($recipient as $key => $value)
		                                        	{
		                                        		echo "<option>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnRecipient" type="submitBtn" class="btn btn-primary"><?php echo $translate->translate('AddRecipient'); ?></button>
                                </div>
                                <div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('DeleteRecipient'); ?></h3>
	                            </div>
	                            <form id="formDelRecipient" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectRecipient"><?php echo $translate->translate('Recipient'); ?></label>
		                                    <select id="selectRecipient" name="selectRecipient" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	foreach ($recipient as $key => $value)
		                                        	{
		                                        		echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnRecipientDel" type="submitBtn" class="btn btn-danger"><?php echo $translate->translate('DeleteRecipient'); ?></button>
                                </div>
                            </div>
	                	</div>
	                	<div class="col-md-6">
	                		<div class="col-md-12 box box-primary">
		                        <div class="form-group">
		                    		<h3><?php echo $translate->translate('delEval'); ?></h3>
		                    		<label><?php echo $translate->translate('deleteEval'); ?></label>
		                    		<input type="text" class="form-control" id="id_to_delete">
		                        </div>
		                        <div class="box-footer">
                                    <button id="deleteIdEval" type="submitBtn" class="btn btn-danger"><?php echo $translate->translate('delete'); ?></button>
                                </div>
			                </div>
	                	</div>
	                	<div class="col-md-6">
	                		<div class="col-md-12 box box-primary">
		                        <div class="form-group">
		                    		<h3><?php echo $translate->translate('deleteEvalRating'); ?></h3>
		                    		<?php 
                                        $eval = new evaluation();
                                        $result = $eval->listedEvalForm();
                                    ?>
                                    <select id="selectedEvaluation" class="form-control" placeholder='test'>
                                        <option disabled selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                        <?php 
                                            foreach ($result as $key => $value)
                                            {
                                                echo '<option value='.$value['id'].'>'. $value['name'] .'</option>';
                                            }
                                        ?>
                                    </select>
                                    
                                </div>
		                        <div class="box-footer">
                                    <button id="deleteIdEvalRating" type="submitBtn" class="btn btn-danger"><?php echo $translate->translate('delete'); ?></button>
                                </div>
			                </div>
	                	</div>
	                	<div class="col-md-6">
	                		<div class="col-md-12 box box-primary">
		                        <div class="form-group">
		                    		<h3><?php echo $translate->translate('renameEvaluationRating'); ?></h3>
		                    		<?php $result = $eval->listedEvalForm(); ?>
                                    <select id="renameEvalRating" class="form-control" placeholder='test'>
                                        <option disabled selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                        <?php 
                                            foreach ($result as $key => $value)
                                            {
                                                echo '<option value='.$value['id'].'>'. $value['name'] .'</option>';
                                            }
                                        ?>
                                    </select>
                                </div>
                                <label></label>
                                <input class='form-group' type='text' id='renamedEval'>
		                        <div class="box-footer">
                                    <button id="renameEval" type="submitBtn" class="btn btn-success"><?php echo $translate->translate('rename'); ?></button>
                                </div>
			                </div>
	                	</div>
	                	<div class="col-md-6">
	                		<div class="box box-primary">
	                        	<div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('AddNewCountry'); ?></h3>
	                                <div class="box-tools pull-right">
                                        <button class="btn btn-primary btn-xs" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-primary btn-xs" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
	                            </div>
	                            <form id="formAddCountry" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group">
	                                        <label for="addCountry"><?php echo $translate->translate('nameNewCountry'); ?></label>
	                                        <input type="text" class="form-control" id="addCountry" name="addCountry">
	                                    </div>
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectCountry"><?php echo $translate->translate('AdminNewAccountAccountCountry'); ?></label>
		                                    <select id="selectCountry" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	$country = $db->getCountry();
		                                        	
		                                        	foreach ($country as $key => $value)
		                                        	{
		                                        		echo "<option>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnCountry" type="submitBtn" class="btn btn-primary"><?php echo $translate->translate('AddNewCountry'); ?></button>
                                </div>
                                <div class="box-header">
	                                <h3 class="box-title"><?php echo $translate->translate('deleteCountry'); ?></h3>
	                            </div>
	                            <form id="formDelCountry" role="form" action="admin.php" method="post">
	                                <div class="box-body">
	                                    <div class="box-content form-group input-group input-group-sm">
	                                    	<label for="selectCountry"><?php echo $translate->translate('AdminNewAccountAccountCountry'); ?></label>
		                                    <select id="selectCountry" name="selectCountry" class="form-control">
		                                        <option><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
		                                        <?php 
		                                        	foreach ($country as $key => $value)
		                                        	{
		                                        		echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
		                                        	}
		                                        ?>
		                                    </select>
		                                </div>
	                                </div>
	                            </form>
	                            <div class="box-footer">
                                    <button id="submitBtnCountryDel" type="submitBtn" class="btn btn-danger"><?php echo $translate->translate('deleteCountry'); ?></button>
                                </div>
                            </div>
	                	</div>
                	<?php endif ?><!-- IF ADMIN -->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
<?php require_once('footer.php');?>
<script>	

	$('#renameEval').click(function () {
		id_eval = $('#renameEvalRating').val();
		rename = $('#renamedEval').val();

		console.log('rename : ' +  rename + ' id : ' + id_eval);

		request = $.ajax({
            url:    'edit_evaluation_form.php',
            type:   'POST',
            data:   {   type 			: 'rename_eval',
                        id_eval         : id_eval,
                        rename 			: rename
                    }
        });

        request.done(function (result) {
        	console.log(result);
            alert('Votre fiche a été renommée en ' + rename);
        });
	});

	$('#deleteIdEvalRating').click(function(){
		id = $('#selectedEvaluation').val();
		console.log(id);

		request = $.ajax({
            url:    'edit_evaluation_form.php',
            type:   'POST',
            data:   {   type 			: 'delete_eval_rating',
                        id_eval         : id
                    }
        });

        request.done(function (result) {
        	console.log(result);
            alert($('#selectedEvaluation option:selected').text() + ' supprimée');
        });

        request.fail(function (jqXHR, textStatus){
            console.log("Request AJAX failed : " + textStatus);
        });
	});

	$('#deleteIdEval').click(function(){
		id = $('#id_to_delete').val();

		request = $.ajax({
            url:    'edit_evaluation_form.php',
            type:   'POST',
            data:   {   type 			: 'delete_id',
                        id_rating       : id
                    }
        });

        request.done(function (result) {
            alert('Evaluation n°' + id + ' supprimée');
        });

        request.fail(function (jqXHR, textStatus){
            console.log("Request AJAX failed : " + textStatus);
        });
	});

	$('#submitBtnCC').click(function (){
		$('#addConsultant').submit();
	});

	$('#submitBtn').click(function(){
        validateForm();   
    });

	$('#submitBtnCountryDel').click(function(){
    	$('#formDelCountry').submit();
    })

	$('#submitBtnCountry').click(function(){
    	$('#formAddCountry').submit();
    })

	$('#submitBtnRecipientDel').click(function(){
    	$('#formDelRecipient').submit();
    })

	$('#submitBtnRecipient').click(function(){
    	$('#formAddRecipient').submit();
    });

    $('#submitBtnUnacceptable').click(function(){
    	$('#fromAddUnacceptable').submit();
    });

    $('#submitBtnDelUnacceptable').click(function(){
    	$('#formDeleteUnacceptable').submit();
    });

	$('#submitBtnGroupDel').click(function(){
		$('#formDelGroup').submit();
	});

    $('#submitBtnGroup').click(function(){
    	validateGroup();
    });

    function validateGroup()
    {
    	var groupReg = /^[a-zA-Z\s]*$/;

    	var groupVal = $('#addGroup').val();
    	$('.error').hide();
    	if (!groupReg.test(groupVal) || groupVal == '')
    	{
    		errorPHP = "<?php echo $translate->translate('JustLetter'); ?>";
			$('#addGroup').after('<span class="error" style="color:red;">'+ errorPHP +'</span>');
    	}
    	else
    	{
    		$('#formAddGroup').submit()
    	}
    }

	function validateForm()
	{
		var topicReg = /^[a-zA-Z\s]*$/;

		var topicVal = $('#topicAdd').val();
		$('.error').hide();
		if (!topicReg.test(topicVal) || topicVal == '')
		{
			errorPHP = "<?php echo $translate->translate('JustLetter'); ?>";
			$('#topicAdd').after('<span class="error" style="color:red;">'+ errorPHP +'</span>');
		}
		else
		{
			$('#addTopic').submit();
		}
	}
</script>
<script>
	function centerModal() {
    $(this).css('display', 'block');
    var $dialog = $(this).find(".modal-dialog");
    var offset = ($(window).height() - $dialog.height()) / 2;
    // Center modal vertically in window
    $dialog.css("margin-top", offset);
	}

	$('.modal').on('show.bs.modal', centerModal);
	$(window).on("resize", function () {
	    $('.modal:visible').each(centerModal);
	});
</script>